//--------------------------------------------------------------------------------
// This file is a \"Sample\" as from Windows Workflow Foundation
// Samples
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
// This source code is intended only as a supplement to Microsoft
// Development Tools and/or on-line documentation.  See these other
// materials for detailed information regarding Microsoft code samples.
// 
// THIS CODE AND INFORMATION ARE PROVIDED AS IS WITHOUT WARRANTY OF ANY
// KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
// PARTICULAR PURPOSE.
//--------------------------------------------------------------------------------
using System;
//using System.ComponentModel;
//using System.Workflow.Activities;
//using System.Workflow.ComponentModel;
using System.Workflow.ComponentModel.Compiler;
//using System.Workflow.ComponentModel.Design;

namespace MNS.Activities
{
    public class IteratorValidator : CompositeActivityValidator
    {
        public override ValidationErrorCollection Validate(ValidationManager manager, object obj)
        {
            if (null == manager)
                throw new ArgumentNullException("manager");
            if (null == obj)
                throw new ArgumentNullException("obj");

            IteratorActivity pif = obj as IteratorActivity;

            if (null == pif)
                throw new ArgumentException("This validator can only be used by the IteratorActivity", "obj");

            ValidationErrorCollection errors = base.Validate(manager, obj);

            //if (null != pif.Parent)
            //{
            //    // Now actually validate the activity...
            //    if (pif.Activities.Count < 2)
            //    {
            //        ValidationError err = new ValidationError("At least two branches are required for a ParallelIf", 100, false);
            //        err.UserData.Add("LESS_THAN_TWO", "There are less than two branches");
            //        errors.Add(err);
            //    }
            //}
            
            return errors;
        }
    }
}